package com.demon.minio.enums;

import org.springframework.util.ObjectUtils;

import java.util.Arrays;
import java.util.stream.Collectors;

public enum UploadStatus implements ICommEnum<String> {
    /**
     * 暂停
     */
    PAUSE("1", "暂停"),
    /**
     * 继续
     */
    CONTINUE("0", "继续");

    UploadStatus(String id, String desc) {
        this.addEnum(this, id, desc);
    }

    public static UploadStatus getById(String id) {
        return Arrays.stream(UploadStatus.values()).collect(Collectors.toMap(UploadStatus::getEnumId, x -> x)).get(id);
    }

    public static boolean checkIll(String id) {
        return ObjectUtils.isEmpty(getById(id));
    }

}
